<include file='Common:header' />

<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">

    <!-- #section:basics/sidebar -->

    <include file='Common:left' />
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">


                <div class="page-header">
                    <h1>
                        您当前操作
                        <small>
                            <i class="ace-icon fa fa-angle-double-right"></i>
                            审核报表
                        </small>
                    </h1>
                </div>
                                <div class="modal fade" id="city" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal"
                                            aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="myModalLabel">
                                        选择国内城市
                                    </h4>
                                </div>
                                <div class="modal-body">
                                    <div class="row">
                                        <div class="col-xs-12">
                                        <form>
                                <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">


                                    <tr>
                                        <td height="30"  style="border-bottom:#CCCCCC solid 1px; line-height:25px; background-color:#F4F8FB">
                                            <label>
                                                <input type="checkbox" class="ace ace-checkbox-2"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
                                                <span class="lbl"> 全选</span>
                                            </label>
                                        </td>


                                    </tr>
                                    <tr>


                                            <td class="company_info" height="30" style="padding-left:70px;border-bottom:#E7EBF8 dashed 1px; color:#666666">

                                                <volist name="city" id="vo">
                                                    <label class="thopen">
                                                        <input name="city[]" class="ace ace-checkbox-2 checkbox-child" type="checkbox"  id="{$vo.id}" value="{$vo.name}"  />
                                                    <span class="lbl" style="margin-right:10px;">{$vo.name}</span>
                                                    </label>
                                                </volist>

                                            </td>


                                    </tr>

                                </table>
                                </form>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <input type="button" id="cityadd" class="btn btn-primary" data-id=""  value="插入"/>
    
                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                        关闭
                                    </button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                </div>
                </div>
                                <div class="modal fade" id="goods" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal"
                                            aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="myModalLabel">
                                        选择商品分类
                                    </h4>
                                </div>
                                <div class="modal-body">
                                    <div class="row">
                                        <div class="col-xs-12">
                                        <form>
                                <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">


                                    <tr>
                                        <td height="30"  style="border-bottom:#CCCCCC solid 1px; line-height:25px; background-color:#F4F8FB">
                                            <label>
                                                <input type="checkbox" class="ace ace-checkbox-2"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
                                                <span class="lbl"> 全选</span>
                                            </label>
                                        </td>


                                    </tr>
                                    <tr>


                                            <td class="company_info" height="30" style="padding-left:70px;border-bottom:#E7EBF8 dashed 1px; color:#666666">

                                                <volist name="goods" id="vo">
                                                    <label class="thopen">
                                                        <input name="goods[]" class="ace ace-checkbox-2 checkbox-child" type="checkbox"  id="{$vo.id}" value="{$vo.name}"  />
                                                    <span class="lbl" style="margin-right:10px;">{$vo.name}</span>
                                                    </label>
                                                </volist>

                                            </td>


                                    </tr>

                                </table>
                                </form>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <input type="button" id="goodsadd" class="btn btn-primary" data-id=""  value="插入"/>
    
                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                        关闭
                                    </button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                </div>
                <div class="modal fade" id="country" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal"
                                            aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="myModalLabel">
                                        选择国家地区
                                    </h4>
                                </div>
                                <div class="modal-body">
                                    <div class="row">
                                        <div class="col-xs-12">
                                        <form>
                                <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">


                                    <tr>
                                        <td height="30"  style="border-bottom:#CCCCCC solid 1px; line-height:25px; background-color:#F4F8FB">
                                            <label>
                                                <input type="checkbox" class="ace ace-checkbox-2"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
                                                <span class="lbl"> 全选</span>
                                            </label>
                                        </td>


                                    </tr>
                                    <tr>


                                            <td class="company_info" height="30" style="padding-left:70px;border-bottom:#E7EBF8 dashed 1px; color:#666666">

                                                <volist name="country" id="vo">
                                                    <label class="thopen">
                                                        <input name="country[]" class="ace ace-checkbox-2 checkbox-child" type="checkbox"  id="{$vo.id}" value="{$vo.name}"  />
                                                    <span class="lbl" style="margin-right:10px;">{$vo.name}</span>
                                                    </label>
                                                </volist>

                                            </td>


                                    </tr>

                                </table>
                                </form>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <input type="button" id="countryadd" class="btn btn-primary" data-id=""  value="插入"/>
    
                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                        关闭
                                    </button>
                                </div>
                            </div><!-- /.modal-content -->
                        </div><!-- /.modal-dialog -->
                </div>



                <div class="row">
                    <div class="col-xs-12">
                        <div>

                            <form id="form0" name="form0" method="post" action="{:U('verify_table_run')}" >

                                <div class="form-group">
                                    <h2 style="text-align: center">{$info.title}({$info.code}表)</h2>
                                </div>
                                <div class="space-4"></div>
                                <div class="form-group">

                                    <label style="margin-left: 10px; float: right;margin-right: 60px;">有效期至：{$info.endtime|date="y-m-d",###}</label>
                                </div>
                                <div class="space-4"></div>

                                <div class="form-group">

                                    <label style="margin-left: 10px;">填报单位：{$u_name}</label>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <label style="margin-left: 10px;">年份：{$info.year} 年</label>
                                </div>
                                <div class="space-4"></div>

                                <input type="hidden" name="tableid"  value="{$info.id}" /><!--用于判断操作类型-->
                                <table width="100%" class="table table-striped table-bordered table-hover" id="dynamic-table">
                                    <thead>
                                    <tr>
                                        <th style="text-align: center;" width="30%">指标名称</th>
                                        <th style="text-align: center;" width="20%">计量单位</th>
                                        <th style="text-align: center;" width="10%">代码</th>
                                        <th style="text-align: center;" width="20%">上年<if condition="$info['quarter'] eq 1">1<else/>1-{$info['quarter']}</if>季度</th>
                                        <th style="text-align: center;" width="20%">本年<if condition="$info['quarter'] eq 1">1<else/>1-{$info['quarter']}</if>季度</th>
                                    </tr>
                                    <tr>
                                        <td style="text-align: center;">甲</td>
                                        <td style="text-align: center;">乙</td>
                                        <td style="text-align: center;">丙</td>
                                        <td style="text-align: center;">1</td>
                                        <td style="text-align: center;">2</td>
                                    </tr>
                                    </thead>

                                    <tbody>



                                    <foreach name="res" item="v">
                                        <tr>
                                            <td height="28" >{$v.name}</td>
                                            <td>{$v.metering}</td>
                                            <td>{$v.code}</td>
                                            <if condition="$key eq 'd5'">
                                            <td style="text-align: center;">
                                                <select style="width: 100%;" name="last[]">
                                                    <option value="">选择类别</option>
                                                    <volist name="xj_type" id="vv">
                                                        <option <if condition="$vv['name'] eq $v['last']">selected="selected"</if> value="{$vv.name}">{$vv.name}</option>
                                                    </volist>
                                                    
                                                    
                                                </select>
                                            </td>

                                            <td style="text-align: center;">
                                                <select style="width: 100%;" name="now[]">
                                                    <option value="">选择类别</option>
                                                    <volist name="xj_type" id="vv">
                                                        <option <if condition="$vv['name'] eq $v['now']">selected="selected"</if> value="{$vv.name}">{$vv.name}</option>
                                                    </volist>
                                                    
                                                    
                                                </select>
                                            </td>
                                            <elseif condition="$key eq 'd6'" />
                                            <td style="text-align: center;">
                                                <select style="width: 100%;" name="last[]">
                                                    <option value="">选择类别</option>
                                                    <volist name="zn_type" id="pp">
                                                        <option <if condition="$pp['name'] eq $v['last']">selected="selected"</if> value="{$pp.name}">{$pp.name}</option>
                                                    </volist>
                                                </select>
                                            </td>

                                            <td style="text-align: center;">
                                                <select style="width: 100%;" name="now[]">
                                                    <option value="">选择类别</option>
                                                    <volist name="zn_type" id="pp">
                                                        <option <if condition="$pp['name'] eq $v['now']">selected="selected"</if> value="{$pp.name}">{$pp.name}</option>
                                                    </volist>
                                                </select>
                                            </td>

                                            <else /> 
                                            <td style="text-align: center;"><input <if condition="$v.last eq '--'">readonly="readonly"</if> style="width: 97%;" name="last[]" 
                                            id="last{$v.code}"
                                            onFocus="choose(<if condition="$v.catgory eq ''">'other'<else />'{$v.catgory}'</if>,'last'+'{$v.code}')" value="{$v.last}" type="text" /></td>

                                            <td style="text-align: center;"><input <if condition="$v.now eq '--'">readonly="readonly"</if>  style="width: 97%;" name="now[]" 
                                            onFocus="choose(<if condition="$v.catgory eq ''">'other'<else />'{$v.catgory}'</if>,'now'+'{$v.code}')"
                                            id="now{$v.code}"
                                            value="{$v.now}" type="text"  /></td>    
                                            </if> 
                                        </tr>
                                    </foreach>
                                    <!--<tr>
                                        <td height="50" colspan="10" align="left">{$show}</td>
                                    </tr>-->
                                    </tbody>
                                </table>
                                <div class="form-group">

                                    <label style="margin-left: 10px;">补充说明:{$info.remark}</label>
                                </div>
                                <div class="space-4"></div>

                                <div class="form-group">

                                    <label style="margin-left: 10px;">单位负责人：{$info.fz}</label>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <label style="margin-left: 10px;">联系人：{$info.lx}</label>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <label style="margin-left: 10px;">填报人：{$info.tb}</label>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <label style="margin-left: 10px;">报出日期：{$info.add_time|date="Y-m-d H:i:s",###}</label>
                                </div>
                                <div class="space-4"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label"  style="margin-left: 34%;"><b>是否通过：</b> </label>
                                    <div class="col-sm-4">
                                        <select name="verify"  class="col-sm-4" id="verify">
                                            <option value="">请选择</option>
                                            <option value="2">驳回</option>
                                            <option value="3">通过</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="space-4"></div>

                                <div class="form-group">

                                </div>
                                <div class="space-4"></div>

                                <div class="clearfix form-actions">
                                    <div class="col-md-offset-5 col-md-9">
                                        <button class="btn btn-info" type="submit">
                                            <i class="ace-icon fa fa-check bigger-110"></i>
                                            保存
                                        </button>

                                        &nbsp; &nbsp; &nbsp;
                                        <button class="btn" type="reset">
                                            <i class="ace-icon fa fa-undo bigger-110"></i>
                                            重置
                                        </button>
                                    </div>
                                </div>

                            </form>


                        </div>
                    </div>
                </div>

                <include file='Common:header_nav' />

            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->


    <script>

    function choose(datatype,id){
            if (datatype == 'goods') {
                $('#goods').modal('show');
                $('#goodsadd').attr('data-id',id);
                return false;
            }else if(datatype == 'city'){
                $('#city').modal('show');
                $('#cityadd').attr('data-id',id);
                return false;
            }else if(datatype == 'country'){
                $('#country').modal('show');
                $('#countryadd').attr('data-id',id);
                return false;
            }
            
        }

        function CheckAll(form){
            for (var i=0;i<form.elements.length;i++){
                var e = form.elements[i];
                if (e.Name != 'chkAll'&&e.disabled==false)
                    e.checked = form.chkAll.checked;
            }
        }
        $('#countryadd').on('click',function(){
            var str = '';
            $.each($('input[name="country[]"]:checked'),function() {
                    str += $(this).val()+'、';
            });
            var id = $('#countryadd').attr('data-id');
            document.getElementById(id).value=str;
            $('#country').modal('hide');
        })

        $('#cityadd').on('click',function(){
            var str = '';
            $.each($('input[name="city[]"]:checked'),function() {
                    str += $(this).val()+'、';
            });
            var id = $('#cityadd').attr('data-id');
            document.getElementById(id).value=str;
            $('#city').modal('hide');
        })

        $('#goodsadd').on('click',function(){
            var str = '';
            $.each($('input[name="goods[]"]:checked'),function() {
                    str += $(this).val()+'、';
            });
            var id = $('#goodsadd').attr('data-id');
            document.getElementById(id).value=str;
            $('#goods').modal('hide');
        })

        $(function(){
            $('#form0').ajaxForm({
                beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
                success: complete, // 这是提交后的方法
                dataType: 'json'
            });

            function checkForm(){
                if ('' == $.trim($('#verify option:selected').val())){
                    layer.alert('请选择是否通过审核', {icon: 5}, function(index){
                        layer.close(index);
                        $('#verify').focus();
                    });
                    return false;
                }
            }
            function complete(data){
                if(data.status==1){
                    layer.alert(data.info, {icon: 6}, function(index){
                        layer.close(index);
                        window.location.href=data.url;
                    });
                }else{
                    layer.alert(data.info, {icon: 6}, function(index){
                        layer.close(index);
                        window.location.href=data.url;
                    });
                }
            }

        });


    </script>
    <include file='Common:footer' />

</div><!-- /.main-container -->
</body>
</html>
